package com.example.travelservlet.utils;

import com.example.travelservlet.entity.TotalRaw;
import com.google.gson.JsonObject;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author kiki
 * @dtae 2023/6/7 8:44
 */
@Data
public class LayuiResponse<T> {
    private static final  Integer CODE = 0;
    private  static final  String MSG = "";

    private  static final  String CHECKIN = "777" ;

    private Integer code;

    private String msg;

    private Integer count;

    private TotalRaw totalRow;

    private T data;

    public static  <T> LayuiResponse<T> ok(T data, Integer count, TotalRaw totalRow) {
        return result(data,count,totalRow);
    }


    private static <T>  LayuiResponse<T> result(T data, Integer count, TotalRaw totalRow) {
        LayuiResponse<T> layuiResponse = new LayuiResponse<>();
        layuiResponse.setData(data);
        layuiResponse.setCode(CODE);
        layuiResponse.setMsg(MSG);
        layuiResponse.setCount(count);
        layuiResponse.setTotalRow(totalRow);
        return layuiResponse;
    }
}

